package com.coolbi.onsupai.core.dao.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;

import com.coolbi.onsupai.core.dao.SettleCategoryDao;
import com.coolbi.onsupai.core.entity.SettleCategory;
import com.coolbi.onsupai.core.mapper.SettleCategoryMapper;

public class SettleCategoryDaoImpl implements SettleCategoryDao {

	@Autowired
	private SettleCategoryMapper settleCategoryMapper;
	
	@Override
	public SettleCategory save(SettleCategory obj) {
		settleCategoryMapper.save(obj);
		return obj;
	}

	@Override
	public int delete(long id) {
		return settleCategoryMapper.delete(id);
	}

	@Override
	public int update(SettleCategory obj) {
		return settleCategoryMapper.update(obj);
	}

	@Override
	public SettleCategory get(long id) {
		return settleCategoryMapper.get(id);
	}

	@Override
	public List<SettleCategory> list() {
		return settleCategoryMapper.list();
	}

	@Override
	public List<SettleCategory> listByPage(int offset, int limit) {
		Map<String, Object> parameter = new HashMap<String, Object>();
		parameter.put("offset", offset);
		parameter.put("limit", limit);
		return settleCategoryMapper.listByPage(parameter);
	}

	@Override
	public List<SettleCategory> find(Map<String, Object> parameter) {
		return settleCategoryMapper.listByParameter(parameter);
	}

	@Override
	public List<SettleCategory> findByPage(Map<String, Object> parameter,
			int offset, int limit) {
		parameter.put("offset", offset);
		parameter.put("limit", limit);
		return settleCategoryMapper.listByParameterPage(parameter);
	}

	@Override
	public List<SettleCategory> search(Map<String, Object> parameter,
			int offset, int limit) {
		parameter.put("offset", offset);
		parameter.put("limit", limit);
		return settleCategoryMapper.search(parameter);
	}

	@Override
	public int count() {
		return settleCategoryMapper.count();
	}

	@Override
	public int countByKeyWord(Map<String, Object> parameter) {
		return settleCategoryMapper.countByKeyWord(parameter);
	}

	@Override
	public int count(Map<String, Object> parameter) {
		return settleCategoryMapper.countByParameter(parameter);
	}

	public void setSettleCategoryMapper(SettleCategoryMapper settleCategoryMapper) {
		this.settleCategoryMapper = settleCategoryMapper;
	}

}
